$(function(){
	ym.ajax({
		url: "/userChild/getUserChild",
		success: function (data) {
		   	if(data.res == 1){
		   		$('.baobao').html("");
               if(data.obj.length > 0){
					var html ="";
					datas=data.obj;
					sessionStorage.setItem('datas',JSON.stringify(datas));
					for(var i=0;i<data.obj.length;i++){
						if(i == 0){
							html += '<option value="'+data.obj[i].childId+'" data-sex="'+data.obj[i].childSex+'" selected>'+data.obj[i].childRealname+'</option>';
						}else{
							html += '<option value="'+data.obj[i].childId+'" data-sex="'+data.obj[i].childSex+'" >'+data.obj[i].childRealname+'</option>';
						}
		   			}
                    $('.baobao').append(html);
		   		}else{
		   			window.location.href = "vaccine1.html";
		   			console.log("没有宝宝");
				}
		   	}else{console.log("获取宝宝失败!")}
		}
	});
})
